<div id="actionbar" class="fn-clear">
    <form id="form" action="{:url('popupshop/item/select')}" method="get">
        <input type="hidden" name="status" value="{$status}"/>
        <input type="hidden" name="input" value="{$input}"/>
        <input placeholder="请输入商品关键字" class="input w200" type="text" name="keyword" value="{$keyword}" />
        <input type="submit" value="搜索" class="button button-blue" />
    </form> 
</div>
<table class="table">
    <thead>
        <tr>
            <th class="fn-tac w60">#</th>
            <th class="fn-tac w80">操作</th>
            <th class="fn-tac w80">状态</th>
            <th>商品名称</th>
            <th class="w100">成本价</th>
            <th class="w140">更新时间</th>
        </tr>
    </thead>
    <tbody>
    {foreach $lists as $vo}
    <tr>
        <td class="fn-tac">{$vo.id}</td>
        <td class="fn-tac"><a href="javascript:;" onclick="select(this)" class="button" id="{$vo.id}">选择</a></td>
        <td class="fn-tac">
            {if $vo.is_sale == 1}<span class="badge bg-red">回收站</span>
            {elseif $vo.is_sale == 2}<span class="badge bg-green">在售</span>
            {else}<span class="badge bg-yellow">下架</span>{/if}
        </td>
        <td>{$vo.name}</td>
        <td>￥{$vo.price/100|money}</td>
        <td>{$vo.update_time|date='Y-m-d H:i'}</td>
    </tr>
    {/foreach}
    </tbody>
</table>
{$lists|raw}
<script type="text/javascript">
Do('base','layer',function (){})
//保存规格
function select(event){
    var index = parent.layer.getFrameIndex(window.name); 
    var ids = $(event).attr('id');
{if $input == 'item_id'}
    parent.$("#iframe")[0].contentWindow.items(ids);
{else}
    var input = '{$input}';
    parent.$("#iframe")[0].contentWindow.giftitem(ids,input);
{/if}
    parent.layer.close(index);
}
</script>